package com.itheima.test6;

import java.util.concurrent.FutureTask;

/**
 * @Author:gy
 * @Date: 2025/09/01 11:14
 * @Description:
 */
public class Demo1 {
    public static void main(String[] args) {
        //首先创建一个Callable 对象
        MyCallable<String> mc = new MyCallable<>();
        //创建一个 FutureTask
        FutureTask<String> ft = new FutureTask<String>(mc);
        //创建几个线程类
        Thread t1 = new Thread(ft);
        t1.setPriority(10);
        int priorit1 = t1.getPriority();
        System.out.println("飞机优先级"+priorit1);
        t1.setName("飞机");
        t1.start();
        MyCallable<String> mc2 = new MyCallable<>();
        FutureTask<String> ft2 = new FutureTask<String>(mc2);
        //创建几个线程类
        Thread t2 = new Thread(ft2);
        t2.setPriority(1);
        int priorit2 = t2.getPriority();
        System.out.println("坦克优先级"+priorit2);
        t2.setName("坦克");
        t2.start();
    }
}
